﻿/*
#**************************************************************************
#  openSIS is a student information system for public and non-public 
#  schools from Open Solutions for Education, Inc. web: www.os4ed.com
#
#  openSIS is  web-based, open source, and comes packed with features that 
#  include student demographic info, scheduling, grade book, attendance, 
#  report cards, eligibility, transcripts, parent portal, 
#  student portal and more.   
#
#  Visit the openSIS web site at http://www.opensis.com to learn more.
#  If you have question regarding this system or the license, please send 
#  an email to info@os4ed.com.
#
#  This program is released under the terms of the GNU General Public License  
#  as  published by the Free Software Foundation, version 2 of the License. 
#  See license.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#**************************************************************************** 

*/

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using OSISGradeLeveDataLayer;

namespace OSISGradeLevelBusinessLayer
{
    /// <summary>
    /// Summary description for GradeLevelBL
    /// </summary>
    public class GradeLevelBL
    {
        private int grdlevelid;
        private string gradelevelname;
        private string gradelevelshortname;
        private string gradelevelshortorder;
        private string lastupdated;
        private int grdlevelidnext;
        private int SchoolID;
        

        public GradeLevelBL()
        {
            grdlevelid = 0;
            gradelevelname = "";
            gradelevelshortname = "";
            gradelevelshortorder = "";
            lastupdated = "01/01/1900";
            grdlevelidnext = 0;
            SchoolID = 0;
        }

        public String GradeLevelName
        {
            get
            {
                return this.gradelevelname;
            }
            set
            {
                this.gradelevelname = value;
            }
        }

        public int School_Id
        {
            get
            {
                return this.SchoolID;
            }
            set
            {
                this.SchoolID = value;
            }
        }

        public String GradeLevelShortName
        {
            get
            {
                return this.gradelevelshortname;
            }
            set
            {
                this.gradelevelshortname = value;

            }
        }

        public String GradeLevelShortOrder
        {
            get
            {
                return this.gradelevelshortorder;
            }
            set
            {
                this.gradelevelshortorder = value;

            }
        }

        public String LastUpdated
        {
            get
            {
                return this.lastupdated;
            }
            set
            {
                this.lastupdated = value;

            }
        }

        public int GrdLevelIdNext
        {
            get
            {
                return this.grdlevelidnext;
            }
            set
            {
                this.grdlevelidnext = value;

            }
        }

        public int GrdLevelId
        {
            get
            {
                return this.grdlevelid;
            }
            set
            {
                this.grdlevelid = value;

            }
        }

        public void AddGradeLevel()
        {
            GradeLevelDL GLDL = new GradeLevelDL();
            GLDL.AddGradeLevels(this);
        }

        public System.Data.DataTable PopulateGradeLevel()
        {
            DataTable dt = null;
            GradeLevelDL GLDL = new GradeLevelDL();
            
            dt = GLDL.GradeLevelDetails(this);
            return dt;
        }

        public DataSet PopulateNextGrade()
        {
            DataSet ds = new DataSet();
            GradeLevelDL GLDL = new GradeLevelDL();
            ds = GLDL.PopulateNextGrade(this);
            return ds;
        }

        public void DeleteGradeLevel()
        {
            GradeLevelDL GLDL = new GradeLevelDL();
            GLDL.DeleteGradeLevel(this);
        }

        public void UpdateGradeLevel()
        {
            GradeLevelDL GLDL = new GradeLevelDL();
            GLDL.UpdateGradeLevel(this);
        }

        public String CheckTitleAndShortName()
        {
            GradeLevelDL GLDL = new GradeLevelDL();
            string TS = GLDL.CheckExistTitleAndShortName(this);
            return (TS);
        }
        public System.Data.DataTable GradeLevelDeleteCheck()
        {
            DataTable dt = null;
            GradeLevelDL GLDL = new GradeLevelDL();
            dt = GLDL.CheckGradeLevelUse(this);
            return dt;
        }
        public System.Data.DataTable GradeLevelUseInNextGradeLevelCheck()
        {
            DataTable dt = null;
            GradeLevelDL GLDL = new GradeLevelDL();
            dt = GLDL.CheckGradeLevelUseInNextGradeLevel(this);
            return dt;
        }

        public void UpdateShortOrder()
        {
            GradeLevelDL GLDL = new GradeLevelDL();
            GLDL.UpdateGradeLevelsShortOrder(this);
        }

       


        public void PopulateMaxGradeLevelID()
        {
            DataTable dt = null;
            GradeLevelDL GLDL = new GradeLevelDL();
            dt = GLDL.PopulateMaxGradeLevelID(this);
            grdlevelid = Convert.ToInt32(dt.Rows[0][0]);

        }
    }
}